package com.guozinhs.auto.screen;

import java.awt.*;

/**
 * 屏幕工具类
 *
 * @Author: GuoZi
 * @Date: 2022/04/26 10:36
 */
public class ScreenUtils {

    public static double getScreenScale() {
        GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice device = graphicsEnvironment.getDefaultScreenDevice();
        Rectangle bounds = device.getDefaultConfiguration().getBounds();
        DisplayMode displayMode = device.getDisplayMode();
        int width = bounds.width;
        int displayWidth = displayMode.getWidth();
        return Math.round(100.0 * displayWidth / width) / 100.0;
    }

}